package com.ovopark.organize.server.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 加盟商 商业立项模版 动态字段 选项 每个选项可以单独配置
 *
 */
@Data
@TableName("is_franchisees_approval_template_field_select")
public class FranchiseesApprovalTemplateFieldSelect implements Serializable {

	@TableId(value = "id", type = IdType.AUTO)
	private Integer id;
	// 字段id
	private Integer fieldId;
	// 选项
	private String name;
    // 排序
	private Integer sort;
	// 1删除0正常
	private Integer isDeleted;
	// 区分多项填空和单项填空 'multipleblank'
	private String selectType;
	// 其他 单选填空前面的固定值
	private String content;
	// 提示文字
	private String text;
	// 选择的类型 text fillblank
	private String type;
	// 文本格式 unlimited不限格式 number数字格式 chinese中文 english英文
	private String format;
	// 小数位数
	private Integer decimalPlaces;
	// 最小值
	private Integer minValue;
	// 最大值
	private Integer maxValue;
	// 最多填写
	private Integer limitLength;
	// 最大总文件上线
	private Integer maxSize;
	// 选项下的填空
	@TableField(exist = false)
	private List<FranchiseesApprovalTemplateFieldSelectFill> resource;

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FranchiseesApprovalTemplateFieldSelect other = (FranchiseesApprovalTemplateFieldSelect) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (sort == null) {
			if (other.sort != null)
				return false;
		} else if (!sort.equals(other.sort))
			return false;
		if (selectType == null) {
			if (other.selectType != null)
				return false;
		} else if (!selectType.equals(other.selectType))
			return false;
		if (content == null) {
			if (other.content != null)
				return false;
		} else if (!content.equals(other.content))
			return false;
		if (text == null) {
			if (other.text != null)
				return false;
		} else if (!text.equals(other.text))
			return false;
		if (type == null) {
			if (other.type != null)
				return false;
		} else if (!type.equals(other.type))
			return false;
		if (format == null) {
			if (other.format != null)
				return false;
		} else if (!format.equals(other.format))
			return false;
		if (decimalPlaces == null) {
			if (other.decimalPlaces != null)
				return false;
		} else if (!decimalPlaces.equals(other.decimalPlaces))
			return false;
		if (minValue == null) {
			if (other.minValue != null)
				return false;
		} else if (!minValue.equals(other.minValue))
			return false;
		if (maxValue == null) {
			if (other.maxValue != null)
				return false;
		} else if (!maxValue.equals(other.maxValue))
			return false;
		if (limitLength == null) {
            return other.limitLength == null;
		} else return limitLength.equals(other.limitLength);
    }

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((sort == null) ? 0 : sort.hashCode());
		result = prime * result + ((selectType == null) ? 0 : selectType.hashCode());
		result = prime * result + ((content == null) ? 0 : content.hashCode());
		result = prime * result + ((text == null) ? 0 : text.hashCode());
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		result = prime * result + ((format == null) ? 0 : format.hashCode());
		result = prime * result + ((decimalPlaces == null) ? 0 : decimalPlaces.hashCode());
		result = prime * result + ((minValue == null) ? 0 : minValue.hashCode());
		result = prime * result + ((maxValue == null) ? 0 : maxValue.hashCode());
		result = prime * result + ((limitLength == null) ? 0 : limitLength.hashCode());

		return result;
	}
}
